﻿using System;

namespace CodeCamp.Models.Email
{
    public class SiteUserListItem
    {
        public int EmailCampaignId { get; set; }
        public string EventShortName { get; set; }
        public bool IsInsider { get; set; }
        public bool IsPresenterAtThisCC { get; set; }
        public Nullable<int> PresenterId { get; set; }
        public DateTime SiteUserCreatedUTC { get; set; }
        public string SiteUserEmail { get; set; }
        public int SiteUserId { get; set; }
        public string SiteUserIdentityProvider { get; set; }
        public Nullable<DateTime> SiteUserLastActivityUTC { get; set; }
        public string SiteUserName { get; set; }
        public decimal AddEmailLinkId
        {
            get
            {
                string rawValue = string.Format("{0}.{1}", SiteUserId, EmailCampaignId);
                decimal compoundId;
                if (decimal.TryParse(rawValue, out compoundId))
                    return compoundId;
                else
                    return (Decimal)EmailCampaignId;
            }
        }
    }
}